package com.asset.dispoal.business.mediation.domain.db.mapper;

import com.asset.dispoal.business.mediation.domain.db.entity.ReduceStagingTmp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 减免预设暂存分期表(ReduceStagingTmp)表数据库访问层
 *
 * @author yf
 * @since 2022-08-26 09:34:22
 */
@Mapper
public interface ReduceStagingTmpMapper {

    /**
     * @param stagingTmps
     * @return
     */
    int insertBatch(@Param("entities") List<ReduceStagingTmp> stagingTmps);

    /**
     * 查询
     *
     * @param stagingIds
     * @return
     */
    List<ReduceStagingTmp> getReduceStagingInfoByIds(String stagingIds);

    /**
     * 获取未还款的分期数
     *
     * @param stagingIds
     * @return
     */
    ReduceStagingTmp getUnrepaidPeriod(String stagingIds);

    /**
     * 根据id查询数据
     *
     * @param id
     * @return
     */
    ReduceStagingTmp queryById(String id);

    /**
     * 通过主键修改
     *
     * @param reduceStagingTmp
     * @return
     */
    int update(ReduceStagingTmp reduceStagingTmp);

    /**
     * 判断是否存在未还的期数
     *
     * @param repaymentIds
     * @return >0 存在  <= 0 不存在
     */
    int toRepaymentPriod(String repaymentIds);
}

